#include <cstdio>

int N, nf=0, a, b, i, j, resp[602], f[300];
bool adj[301][301];

void read(){
	scanf("%d", &N);
	for(i=1;i<N;i++){
		scanf("%d %d", &a, &b);
		adj[a][b]=adj[b][a]=1;
	}
	while(scanf("%d", &a)==1)f[nf++]=a;
}
void process(){
	for(i=1;i<=N;i++){
		printf("\n%d :", i);
		for(j=i+1;j<=N;j++)
			if(adj[i][j])printf("%d ", j);
	}
}

int main(){
	freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
	
	read();
	process();
	return 0;
}
